package com.lantosec.hmrp.modules.notify.controller;


import com.lantosec.hmrp.core.log.ControllerLog;
import com.lantosec.hmrp.core.log.LogType;
import org.springframework.web.bind.annotation.RequestMapping;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.BindingResult;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import com.lantosec.hmrp.core.kit.Result;
import com.lantosec.hmrp.modules.notify.entity.NotifyPublicRead;
import com.lantosec.hmrp.modules.notify.service.INotifyPublicReadService;
import com.lantosec.hmrp.modules.notify.vo.NotifyPublicReadVO;

import java.util.Arrays;
import java.util.List;
import lombok.extern.log4j.Log4j2;
import org.springframework.web.bind.annotation.RestController;
import com.lantosec.hmrp.core.mvc.BaseController;

/**
 *
 * 公告读看信息 控制器
 *
 * @author AutoCode
 * @since 2020-05-22
 */
@Api(value = "公告读看信息控制器", tags = "公告读看信息控制器")
@RestController
@RequestMapping("/notify/public/read")
@Log4j2
public class NotifyPublicReadController extends BaseController {
    @Autowired
    private INotifyPublicReadService service;


    @GetMapping("get/{id}")
    @ApiOperation(value = "主键查询")
    public Result<NotifyPublicReadVO> get(@ApiParam(value = "ID", required = true) @PathVariable(name="id") String id){
        return Result.ok(entity2VO(service.getById(id)));
    }

    @PostMapping("create")
    @ControllerLog(name = "新增系统公告", type = LogType.add)
    @ApiOperation(value = "新增系统公告")
    public Result<String> create(@ApiParam(value = "公告读看信息VO对象", required = true) @RequestBody @Validated List<NotifyPublicReadVO> notifyPublicReadVOList){
        service.insertNotifyPublicRead(notifyPublicReadVOList);
        return Result.ok();
    }

}
